<?php
$fn_strona = "./strona.html";
$fn_kody = "./kody.txt";

if(!isSet($_GET["hash"])){
  die("error\nNieprawidowe wywoanie skryptu.");
}

if(!$arr = file($fn_kody)){
  die("error:Bd serwera. Strona nie jest dostpna.");
}

foreach($arr as $code){
  if($_GET["hash"] == sha1(rtrim($code))){
    if(is_readable($fn_strona)){
      readfile($fn_strona);
      exit;
    }
    else{
      die("error\nStrona nie jest w tej chwili dostpna.");
    }
  }
}
echo "error\nKod jest nieprawidowy.";
?>